<?php
/*
 * Last Edited: 27-7-2013
 */
class CategoryModel extends Zend_Db_Table_Abstract{
	protected $_name = 'game_category';
	protected $_primary = "id";
	protected  $_itemPerPage = 5;
	
/* 
 * Lay danh sach cac the loai game
 */
	public function getList($params=NULL,$options=NULL){
		$db = Zend_Registry::get('connectDB');
		$mySql = $db->select()
					->from($this->_name);
        if(isset($options['status'])){
            $mySql->where('status=?', $options['status']);
        }
		$list = $db->fetchAll($mySql);
		return $list;
	}
	
    public function multiDelete($params,$options=NULL){
		if (!empty($params))	
			foreach ($params as $key => $id) {
				$where = array("id = ".intval($id));
				if ($id != 0) {
					self::delete($where);	
				}
			}
    }
    
	public function getItem($params=NULL,$options=NULL){
		if (isset($params['id'])){			
			$db = Zend_Registry::get('connectDB');
			$mySql = $db->select()
						->from($this->_name)
						->where('id = ?', $params['id']);
			return $db->fetchRow($mySql);	
		}
		return false;
	}
}